package com.iqiyi.pps.epg.core.model.carousel;

import com.iqiyi.pps.epg.core.model.program.ProgramData;

import java.sql.Timestamp;

public class ProgramQipuData {
    public boolean isIllegal() {
        return original.getIllegalStatus() != ProgramData.ILLEGAL_STATUS_NO_ERROR;
    }

    public void setIllegal(boolean illegal) {
        if (illegal) {
            original.setIllegalStatus(ProgramData.ILLEGAL_STATUS_ERROR);
        } else {
            original.setIllegalStatus(ProgramData.ILLEGAL_STATUS_NO_ERROR);
        }
    }

    private ProgramData original = new ProgramData();

    private int instanceCount;

    public int getDuration() {
        return original.getDuration();
    }

    public String getReferContentType() {
        return original.getReferContentType();
    }

    public void setReferContentType(String contentType) {
        contentType = contentType == null ? "" : contentType;
        original.setReferContentType(contentType);
    }

    public void setDuration(int duration) {
        original.setDuration(duration);
    }

    public ProgramData getOriginal() {
        return original;
    }

    public boolean hasInstance() {
        return this.instanceCount > 0;
    }

    public void addInstanceCount() {
        this.instanceCount++;
    }

    public void setAlbumName(String albumName) {
        albumName = albumName == null ? "" : albumName;
        original.setAlbumName(albumName);
    }

//    public String getAlbumName() {
//        return original.getAlbumName();
//    }

    public void setStartTime(long timeInMillis) {
        original.setStartPlayTime(new Timestamp(timeInMillis));
        original.setStreamStartTime(new Timestamp(timeInMillis));
    }

    public void setEndTime(long timeInMillis) {
        original.setStopPlayTime(new Timestamp(timeInMillis));
        original.setStreamEndTime(new Timestamp(timeInMillis));
    }

}
